﻿Imports System.Data
Partial Class Admin_frmModifyCountry
    Inherits System.Web.UI.Page
    Dim VarCName As String
    Dim _CountryVO As New CountryVo
    Dim _BO As New Bo
    Dim _EmployeeId As String
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        _EmployeeId = Session("EmpId")
        If _EmployeeId = "" Then
            Response.Redirect("../Client/frmLogin.aspx")
        End If
        VarCName = Request.QueryString("CountryId")
        If VarCName = "" Then
            Response.Redirect("frmTabCountry.aspx")
        Else
            If Not IsPostBack Then
                GetCountryData()
            End If
        End If
    End Sub
    Sub GetCountryData()
        _CountryVO = _BO.getCountryById(VarCName)
        lblCountry.Text = _CountryVO.CountryId
        txtCountryName.Text = _CountryVO.CountryName
    End Sub
    Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
        SetData()
        Session("EmpId") = _EmployeeId
    End Sub
    Sub SetData()
        _CountryVO.CountryId = lblCountry.Text
        _CountryVO.CountryName = txtCountryName.Text
        _BO.ModifyCountry(_CountryVO)
        ClearAll()
    End Sub
    Public Sub ClearAll()
        txtCountryName.Text = ""
        MsgBox("Country Modified")
        Response.Redirect("frmTabCountry.aspx", False)
    End Sub

    Protected Sub btnReset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReset.Click
        txtCountryName.Text = ""
    End Sub
End Class
